$('body').on('paste', function(event){
  var pos = $('#editor textarea').getCursorPosition();
  console.log(pos);
  var clipboard = event.clipboardData || event.originalEvent.clipboardData;
  var type = clipboard.items[0].type;
   if (type.match(/image/)) {
      var blob = clipboard.items[0].getAsFile();
      var formdata=new FormData();// 创建form对象
      formdata.append('img_0',blob);// 通过append向form对象添加数据,可以通过append继续添加数据
      formdata.append('filesCount',1);
      let config = {
        headers:{'Content-Type':'multipart/form-data'}
      };  //添加请求头
      axios.post('/rbac/file/upload',formdata,config)
        .then(function (response) { 
          var imgFiles=response.data;
          var imgFilesString='';
          _.forEach(imgFiles,function(file){
            imgFilesString=imgFilesString+'![default]('+file+')';
          });
          var textarea_content=$('#editor textarea').val();
          textarea_content=textarea_content.substring(0,pos)+imgFilesString+textarea_content.substring(pos);
          $('#editor textarea').val(textarea_content);
          $('#htmlMarkdown').html(myMarked(textarea_content));
        })
        .catch(function (error) {
          console.log(error);
        });
       // var reader = new FileReader();
       // reader.addEventListener("load", function () {             
       //        console.log(reader.result);
       // }, false);
       // reader.readAsDataURL(blob);
       event.preventDefault();
   } else {
      console.log('not an image',type);
   }
});